package com.szqhyxj.youxiangju.biz.invitationJoin;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.widget.ImageView;
import android.widget.TextView;

import com.szqhyxj.youxiangju.R;
import com.szqhyxj.youxiangju.biz.core.UserInfoManger;
import com.szqhyxj.youxiangju.sys.components.BitmapUtil;
import com.szqhyxj.youxiangju.sys.components.NavigationBar;

import butterknife.BindView;
import butterknife.ButterKnife;

/**
 * Created by leung on 2018/10/30.
 */

public class InvitationJoinActivity extends Activity implements NavigationBar.NavigationBarListener{

    @BindView(R.id.navigationBar)
    NavigationBar navigationBar;
    @BindView(R.id.invitationName)
    TextView invitationName;
    @BindView(R.id.invitationPhone)
    TextView invitationPhone;
    Bitmap bitmap;
    @BindView(R.id.invitationPhoneQR)
    ImageView invitationPhoneQR;

    public static void start(Activity activity) {
        Intent intent = new Intent();
        intent.setClass(activity, InvitationJoinActivity.class);
        activity.startActivity(intent);
    }

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_invitation_join);
        ButterKnife.bind(this);
        invitationName.setText(UserInfoManger.INSTANCE.getUser().getUsername());
        invitationPhone.setText(UserInfoManger.INSTANCE.getUser().getUseraccount());
        bitmap = BitmapUtil.create2DCoderBitmap("http://www.baidu.com", 800, 800);
        invitationPhoneQR.setImageBitmap(bitmap);
        navigationBar.setNavigationBarListener(this);
    }

    @Override
    public void navigationLeft() {
        finish();
    }

    @Override
    public void navigationRight() {

    }
}
